﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CMSApplication.Models.PageDesign
{
    public class HtmlElement
    {
        //public int? ElementID { get; set; }
        public string ElementType { get; set; } // div, paragraph, form, etc
        public List<HtmlElement> Elements { get; set; } // can hold other html elements
        public string Id { get; set; } // html element id
        public string Name { get; set; } // Html element name
        public string Style { get; set; } // can give it an inline style
        public string Class { get; set; } // can give it a class
        public string Content { get; set; } // content inside element

        public HtmlElement()
        {
            ElementType = "p";
            Elements = null;
            Id = "";
            Name = "";
            Style = "";
            Class = "";
            Content = "";
        }

        public HtmlElement(string type)
        {
            ElementType = type;
            Elements = null;
            Id = "";
            Name = "";
            Style = "";
            Class = "";
            Content = "";
        }

        public HtmlElement(string type, List<HtmlElement> elmnts)
        {
            ElementType = type;
            Elements = elmnts;
            Id = "";
            Name = "";
            Style = "";
            Class = "";
            Content = "";
        }

        public HtmlElement(string type, List<HtmlElement> elmnts, string id_, string name_)
        {
            ElementType = type;
            Elements = elmnts;
            Id = id_;
            Name = name_;
            Style = "";
            Class = "";
            Content = "";
        }

        public void addStyle(string style_)
        {
            this.Style = style_;
        }

        public void assignClass(string class_)
        {
            this.Class = class_;
        }

        public void addContent(string content_)
        {
            this.Content = content_;
        }

        public void addChildElement(HtmlElement e)
        {
            this.Elements.Add(e);
        }

        public void deleteChildElement(int i)
        {
            this.Elements.RemoveAt(i);
        }
    }
}